const { defineConfig } = require('@vue/cli-service');
const WebpackObfuscator = require('webpack-obfuscator'); // npm i webpack-obfuscator javascript-obfuscator

module.exports = {
  ...defineConfig({
    transpileDependencies: true,
  }),
  configureWebpack: (config) => {
    if (process.env.NODE_ENV === 'production') {
      // 启用Webpack Obfuscator插件进行代码加密
      config.plugins.push(
        new WebpackObfuscator({
          rotateUnicodeArray: true, // 打乱Unicode数组顺序
        })
      );
    }
  },
};
